home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / t_os / cdplay_y / pad.c < prev   
Text File  |  1993-07-08  |  1KB  |  76 lines

  1. #define CONSOLE 1
  2. #define TEST 0
  3.  
  4. /*    パッドによる制御 */
  5.  
  6. #include    <cdrfrb.h>
  7. #include    <stdio.h>
  8. #include    <stdlib.h>
  9. #include    <snd.h>
  10. #include    "cdp.h"
  11.  
  12. void whatkey();
  13. int        a_old =0 ;
  14.  
  15. void pad_sel()
  16.     {
  17.     int        stat = 0;
  18.     int        a = 0;
  19.     int        key = 0;
  20.  
  21.     SND_joy_in_2( 0, &stat);
  22.  
  23.     a = ~stat; /* ビットの反転 */
  24.     a &= 0xff; /* 下8桁のみ残して削る */
  25.  
  26.     if( a_old != a )
  27.         {
  28.         #if TEST
  29.         printf("\n PAD status => 0x0%x\n", a);
  30.         #endif
  31.         switch( a ) {
  32.             case    0x01: /* 上 */
  33.                 cdp_cont();
  34.                 break;
  35.             case    0x02: /* 下 */
  36.                 cdp_p_c();
  37.                 break;
  38.             case    0x04: /* 左 */
  39.                 cdp_back();
  40.                 break;
  41.             case    0x08: /* 右 */
  42.                 cdp_next();
  43.                 break;
  44.             case    0x10: /* ボタンA */
  45.                 cdp_first_go();
  46.                 break;
  47.             case    0x20: /* ボタンB */
  48.                 cdp_stop();
  49.                 break;
  50.             case    0x40: /* RUN */
  51.                 exit(0);
  52.             case    0x80: /* SELECT */
  53.                 whatkey();
  54.             }
  55.         }
  56.     a_old = a;
  57.     }
  58.  
  59.  
  60. /* キーボード利用 */
  61.  
  62. #include    <fmcfrb.h>
  63.  
  64. void whatkey()
  65.     {
  66.     unsigned int mus_num =0;
  67.  
  68.     #if CONSOLE
  69.     printf(" 次の曲の番号を指定してください →");
  70.     #endif
  71.     scanf("%u",&mus_num ); 
  72.     printf("mus_num = %d\n", mus_num);
  73.     cdp_go( mus_num , 1 );
  74.     }
  75.  
  76.